#!/usr/bin/Python
#! -*- coding：utf-8 -*-
#99乘法表

#for in 四种99

print('='*40,'for in','='*40)

#第一种

for i in range(1,10):
	for j in range(1,i+1):
		print('{0}*{1}={2:<5}'.format(j,i,i*j),end = '')
	print('')

print('='*80)

#第二种

for i in range(9,0,-1):
	for j in range(1,i+1):
		print('{0}*{1}={2:<5}'.format(j,i,i*j),end = '')
	print('')

print('='*80)

#第三种

for i in range(1,10):
	print('         '*(9-i),end = '')
	for j in range(i,0,-1):
		print('{0}*{1}={2:<5}'.format(i,j,i*j),end = '')
	print('')

print('='*80)

#第四种

for i in range(9,0,-1):
	print('         '*(9-i),end = '')
	for j in range(i,0,-1):
		print('{0}*{1}={2:<5}'.format(j,i,i*j),end = '')
	print('')

print('='*80)

#while 四种99

print('='*40,'while','='*40)

#第一种

i = 1
while i <= 9:
	j = 1
	while j <= i:
		print('{0}*{1}={2:<5}'.format(j,i,i*j),end = '')
		j += 1
	print('')
	i += 1

print('='*80)

#第二种

i = 9
while i >= 1:
	j = 1
	while j <= i:
		print('{0}*{1}={2:<5}'.format(j,i,i*j),end = '')
		j += 1
	print('')
	i -= 1

print('='*80)

#第三种

i = 1
while i <= 9:
	print('         '*(9-i),end = '')
	j = i
	while j > 0:
		print('{0}*{1}={2:<5}'.format(i,j,i*j),end = '')
		j -= 1
	print('')
	i += 1

print('='*80)

#第四种

i = 9
while i >= 1:
	print('         '*(9-i),end = '')
	j = i
	while j > 0:
		print('{0}*{1}={2:<5}'.format(j,i,i*j),end = '')
		j -= 1
	print('')
	i -= 1

print('='*80)